import request from '@/utils/request.js'

export function getList(params) {
    return request({
      url: '/sys/user',
      params
    })
}

export function delEmployee(id) {
  return request({
    url: `/sys/user/${id}`,
    method: 'delete'
  })
}

export function addEmployee(data) {
  return request({
    url: '/sys/user',
    method: 'post',
    data
  })
}

export function getDepartments() {
  return request({
    url: '/company/department'
  })
}

export function addExcel(data) {
  return request({
    url: '/sys/user/batch',
    method: 'post',
    data
  })
}

export function updateBaseInfo(data) {
  return request({
    url: `/sys/user/${data.userid}`,
    method: 'put',
    data
  })
}

// 以下两个为一组
export function updateInfo(data) {
  return request({
    url: `/sys/user/${data.id}`,
    method: 'put',
    data
  })
}

export function getInfo(id) {
  return request({
    url: `/sys/user/${id}`
  })
}

// 分配角色
export function setRole(data) {
  return request({
    url: '/sys/user/assignRoles',
    method: 'put',
    data
  })
}
